package com.denlaku.longan.repository;

import com.denlaku.longan.anno.VarOp;
import com.denlaku.longan.dao.CustomApiFieldDao;
import com.denlaku.longan.vo.CustomApiField;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author tianx
 */
@Repository
public class CustomApiFieldRepository {
    @Autowired
    private CustomApiFieldDao customApiFieldDao;

    /**
     * 查询api字段
     *
     * @param tenantId 租户ID
     * @param apiId API ID
     * @return 定制api字段
     */
    public List<CustomApiField> list(Long tenantId, Long apiId) {
        return customApiFieldDao.list(tenantId, apiId);
    }

    /**
     * 添加api字段信息
     *
     * @param fields api字段信息
     */
    @VarOp
    public void batchAdd(List<CustomApiField> fields) {
        customApiFieldDao.batchAdd(fields);
    }

    /**
     * 删除api字段
     *
     * @param tenantId 租户ID
     * @param apiId apiID
     */
    public void delete(Long tenantId, Long apiId) {
        customApiFieldDao.delete(tenantId, apiId);
    }

}
